//封装jsonp方法
export default function jsonp(setting) {
  setting.data = setting.data || {}
  setting.key = setting.key || 'callback'
  setting.callback = setting.callback || function () {}
  //指定jsonp的回调方法名称
  setting.data[setting.key] = 'w'
  // jsonp回调方法
  window.w = function (data) {
    setting.callback(data)
  }
  var script = document.createElement('script')
  var query = []
  for (var key in setting.data) {
    query.push(key + '=' + encodeURIComponent(setting.data[key]))
  }
  script.src = setting.url + '&' + query.join('&')
  document.head.appendChild(script)
  document.head.removeChild(script)
}
//使用jsonp
// jsonp({
// 		url: 'http://127.0.0.1:8070/IntelligentReminderCaller/openPageGet?JsonBase64UrlEncode='+dataUrlEncode,
// 		key: 'callback',
// 		data: {},
// 		callback: function(res){
//             //回调结果在这里
// 			console.log(res)
// 		}
// 	})
